const db = require('../../../libs/db.config');

module.exports = async (data) => {
    // const searchSQL = `SELECT * FROM user WHERE userName = "${username}"`;
    // const searchSQL = 'select coupon.couponID, coupon.type, coupon.denomination, coupon.beginTime, coupon.endTime, userinfo.userName as shopName from coupon join userinfo on userinfo.userID = coupon.shopID where coupon.userID = ?';
    const searchSQL = 'select coupon.couponID, coupon.shopID, coupon.type, coupon.denomination, coupon.beginTime, coupon.endTime, userinfo.userName as shopName from coupon left join userinfo on userinfo.userID = coupon.shopID where coupon.userID = ?';
    return await db.query(searchSQL, [data.userID]);
};
